package helper;

import play.mvc.Http.Cookie;
import play.mvc.Http.Request;
import play.mvc.Http.Response;;

public class RedirectHelp {
	
	private final static String pathCookieName = "redirectPath";
	
	public static void setRedirectPath(Response response,String path)
	{
		response.setCookie(pathCookieName, path);
	}
	
	public static String getRedirectPath(Request request){
		Cookie cookie = request.cookies.get(pathCookieName);
		if(null == cookie || null == cookie.value){
			return "/";
		}else {
			return cookie.value;
		}
	}
	
}